home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
programming
/
c
/
stringlib
/
doku
/
stringlib.readme.orig
< prev
Wrap
Text File
|
1999-06-14
|
4KB
|
89 lines
POSTER:
=======
Article 235 of mod.sources:
Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site unisoft.UUCP
Path: unisoft!lll-lcc!vecpyr!amd!amdcad!decwrl!decvax!genrad!mit-eddie!mirror!sources-request
From: sources-request@mirror.UUCP
Newsgroups: mod.sources
Subject: v06i043: X3J11/SVID/4BSD/etc string library (stringlib)
Message-ID: <125@mirror.UUCP>
Date: 8 Jul 86 21:35:35 GMT
Date-Received: 9 Jul 86 14:14:59 GMT
Sender: rs@mirror.UUCP
Lines: 1515
Approved: rs@mirror.UUCP
Submitted by: ihnp4!utzoo!henry (Henry Spencer)
Mod.sources: Volume 6, Issue 43
Archive-name: stringlib
[ This is an update of the string library Henry posted to net.sources
some time ago. It is different from a recent library published in
volume 4 in these two respects:
1. It comes with a fairly exhaustive test program, which it passes.
2. It does not invent new functions; it implements the union of those
described in X3J11, the SVID, etc., and nothing else.
It would be nice if everyone -- vendors, users -- put the "missing"
functions into their C library, and we could all live in harmony,
but I suspect that's wishful thinking. (Yeah, yeah: efficiency, too.)
This is also excempted from my mandatory manpage requirement, for
reasons mentioned and alluded to in the second paragraph of the README
file. --r$ ]
readme:
-------
This is a public-domain reimplementation of string(3) and friends, notably
memory(3) and bstring(3) (except ffs). Not derived from licensed software.
This code may be used on any computer system for any purpose by anyone.
Relative to my old net.sources posting, this one adds some functions and
fixes one or two obscure bugs. There has been another string library
posted in recent times, with many more functions; I haven't inspected it
and can't comment on its relationship to mine. Alas, the manual pages
for this stuff are copyright by various people other than me, so I can't
include them. See your local Unix manuals.
This distribution implements precisely the union of the string functions
of the SVID, 4BSD, X3J11, and V7. Included is a large test program that
exercises everything quite thoroughly. (Note that some existing libraries,
including e.g. V7, flunk one or more of these tests.)
In the event of conflict between the definitions from various places, the
newer or more portable one is chosen. That is, X3J11 overrules the SVID,
which in turn overrules older Unixes.
The code is written for maximal portability. Some efficiency has been
sacrificed in the cause of meticulously avoiding possible portability
problems. For example, this code never assumes that a pointer can be
moved past the end of an array and then backed up. Many of these functions
can be implemented more efficiently if machine-dependent assumptions are
made; memcpy is a particular glaring case.
Simplistically: put this stuff into a source directory, inspect Makefile
for compilation options that need changing to suit your local environment,
and then do "make r". This compiles the functions and the test program and
runs the tests. If there are no complaints, put string.h in /usr/include
(you may also want to "make memory.h" and put it in /usr/include) and add
the functions (*.o except for tester.o) to your C library. The internal
interdependencies are:
index needs strchr
rindex needs strrchr
bcopy needs memcpy
bcmp needs memcmp
bzero needs memset
I haven't included an implementation of Berkeley's ffs function partly
because it's not trivial to do in a portable way, and partly because I
don't really see it as a string function.
A weakness in the tester program is that it uses quite short strings for
everything, and pays no real attention to alignment issues. Optimized
implementations of things like memcpy would need a more elaborate set of
test cases to put them through their full paces.
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,decvax,pyramid}!utzoo!henry
Wed Jun 25 19:21:34 EDT 1986